package com.inossem.warehousestorage_inossem.request.inventory.chuangyou;

import android.content.Context;

import com.google.gson.Gson;
import com.inossem.warehousestorage_inossem.bean.inventory.chuangyou.InventoryCommitMatBean;
import com.inossem.warehousestorage_inossem.bean.inventory.chuangyou.InventoryCommitMatRequestBean;
import com.inossem.warehousestorage_inossem.constant.RequestConstant;
import com.inossem.warehousestorage_inossem.listener.GsonBeanListener;
import com.inossem.warehousestorage_inossem.listener.StringRequestListener;
import com.inossem.warehousestorage_inossem.manage.RequestManage;
import com.inossem.warehousestorage_inossem.model.StringResponse;
import com.inossem.warehousestorage_inossem.request.Request;

/**
 * TODO
 *
 * @author 詹建宇
 * @time on 2018/4/2 20:11
 * @email jianyu.zhan@inossem.com
 */
public class InventoryCommitMatRequest extends Request{

    public static String request(Context context, InventoryCommitMatRequestBean bean, GsonBeanListener gsonBeanListener) {
        String tag;
        Gson gson = new Gson();
        String json = gson.toJson(bean, InventoryCommitMatRequestBean.class);
        String url = RequestManage.getUrl(context, RequestConstant.URL_INVENTORY_COMMMIT_MAT);
        tag = RequestManage.getHttpsPostWithLoading(context, url, json, new StringRequestListener() {
            @Override
            public void onSuccess(StringResponse stringRequestResponse) {
                Gson gson = new Gson();
                InventoryCommitMatBean bean = gson.fromJson(stringRequestResponse.getResponseInfo(), InventoryCommitMatBean.class);
                excuteJsonBeanNew(context, bean, gsonBeanListener);
            }
        });
        return tag;
    }

}
